package han.controller;

import han.dao.UserMapper;
import han.pojo.Users;
import han.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * @authou HanDianWei
 * @create 2020-10-29 14:59
 */
@Controller
public class UserController {
    @Autowired
    @Qualifier("UserService")
    private UserService userService;

    @RequestMapping("toLogin")
    public String toLogin(){
        return "admin/loginA";
    }
    @RequestMapping("toLoginC")
    public String toLogin1(){
        return "admin/loginC";
    }

//    admin登录
    @RequestMapping("/main")
    public String loginA(HttpSession session, Users users){
        Users loginUser = userService.loginUserA(users);
        if(loginUser!=null) {
            return "admin/main";
        }else{
            return "admin/loginA";
        }

    }

// 城管登录

    @RequestMapping("/mainC")
    public String loginC( Users users){
        Users loginUser = userService.loginUserC(users);
        if(loginUser!=null) {
            return "admin/mainC";
        }else{
            return "admin/loginC";
        }

    }
}
